package com.zf.mall.common.util;

import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester;

public class MD5Utils {

	/***
	 * 
	 * @param context : 加密内容
	 * @param slat : 盐值
	 * @return
	 */
	public static String md5(String context, String slat) {
		Digester md5 = new Digester(DigestAlgorithm.MD5);
		md5.setSalt(slat.getBytes());
		md5.setSaltPosition(1);
		//md5.setDigestCount(3);
		return md5.digestHex(context);
	}

	/***
	 * 
	 * @param context : 加密内容
	 * @return
	 */
	public static String md5(String context) {
		Digester md5 = new Digester(DigestAlgorithm.MD5);
		//md5.setDigestCount(3);
		return md5.digestHex(context);
	}

	public static void main(String[] args) {
		String dc = "123456";
		System.out.println(md5(dc,"FDFAF"));
		System.out.println(md5(dc));
	}

}
